﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace SignatureWebApi.Controllers
{
    /// <summary>
    /// TestAPI for guest users.
    /// </summary>
    [Authorize(Roles = "guest")]
    public class ValuesController : ApiController
    {
        /// <summary>
        /// Return parameter.
        /// </summary>
        /// <param name="para">para for return</param>
        ///  /// <returns>Return the para you just sent</returns>
        public Dictionary<string, object> Get(string para)
        {
            return new Dictionary<string, object>()
            {
                { "UserName", para}
            };
        }
        /// <summary>
        /// Return id.
        /// </summary>
        /// <param name="id">id in path</param>
        /// <returns>Return id</returns>
        public string Get(int id)
        {
            return id.ToString();
        }

        /// <summary>
        /// 测试类
        /// </summary>
        public class TestClass
        {
            /// <summary>
            /// 测试值
            /// </summary>
            public string value { get; set; }
        }
        /// <summary>
        /// Return value.
        /// </summary>
        /// <param name="value"></param>
        /// <returns>Return value</returns>
        public string Post(TestClass value)
        {
            return value.value;
        }
    }
}
